package org.sn.jdish.designmode.memento;

public class MementoMain {

	public static void main(String[] args) {
		//  创建原始类
		Original org = new Original("egg");

		//  创建备忘录
		Storage store = new Storage(org.createMemento());

		//  修改原始类的状态
		System.out.println("init state: " + org.getValue());
		org.setValue("egg1");
		System.out.println("modify state: " + org.getValue());

		//  恢复原始类的状态
		org.restoreMemento(store.getMemento());
		System.out.println("reset state: " + org.getValue());
	}

}
